package com.dds.demo.controller;

import java.awt.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dds.demo.config.ContextHolder;
import com.dds.demo.entity.PageInfo;
import com.dds.demo.entity.WmsToErp;
import com.dds.demo.service.api.WmsToErpService;
import com.dds.demo.util.BeanUtils;

import io.swagger.annotations.ApiOperation;

/**
 * 前端控制器
 *
 */
@Controller
@RequestMapping("/wms")
public class WmsToErpController {

	
	@Autowired 
	private WmsToErpService service;
	
    
    private Logger logger = Logger.getLogger(getClass());
	
	@GetMapping("/index")
	public String manager() {
		return "testdemo";
	}
	
	@ApiOperation(value="获取LISt信息...", produces = "application/json; charset=utf-8")
	@RequestMapping(value="/list",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public PageInfo pageList(WmsToErp bean) {
		System.out.println("获取当前数据源"+ContextHolder.getDataSource());
		logger.error("获取当前数据源1"+ContextHolder.getDataSource());
		PageInfo pageInfo = new PageInfo(1, 20, null,null);
		Map<String, Object> condition = BeanUtils.transBean2Map(bean);
		pageInfo.setCondition(condition);
		service.dataGridByList(pageInfo);
		 return pageInfo;
	}
	@ApiOperation(value="获取LISt信息...", produces = "application/json; charset=utf-8")
	@RequestMapping(value="/list2",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public java.util.List ByList() {
		return service.ByList();
	}
	
	
	
}
